Ext.define('cfWeb.view.appMonitor.AppMonitorView', {
    extend: 'Ext.container.Container',
    alias: 'widget.appMonitorView',
    overflowY: 'auto',
    overflowX: 'hidden',
    initComponent: function() {
        this.items = [{
            xtype: 'collapsibleBlock',
            searchable: true,
            title:'应用监控',
            items: [{
                xtype: 'cbuttonIconListView',
                id: 'temp',
                detailList: [{
                    name: cfWebLang.AppManageView.RunStatus,
                    dataIndex: 'status',
                    unit: ''
                },
                    {
                        name: cfWebLang.AppManageView.InstanceNumber,
                        dataIndex: 'instance',
                        unit: ''
                    },
                    {
                        name: [cfWebLang.AppManageView.Mem, cfWebLang.AppManageView.Disk],
                        dataIndex: ['memory', 'space'],
                        unit: ['G', 'G']
                    },
                    {
                        name: cfWebLang.AppManageView.RunEnv,
                        dataIndex: 'runtime',
                        unit: ''
                    },
                    {
                        name: cfWebLang.AppManageView.Service,
                        dataIndex: 'service',
                        unit: '',
                        renderer: function(v) {
                            if(typeof v !== 'string')return ;
                            var items = v.split(',');
                            var lth = items.length - 1;
                            var res = '';
                            for (var i = 0; (i < lth) && (i < 4); i++) {
                                var type = items[i].split('_')[0].toLowerCase();
                                res += '<span class="service_sign ' + type + '" title="' + items[i] + '"></span>';
                            }
                            if (lth > 4) {
                                res += '<span class="service_more"></span>';
                            }
                            console.log(res);
                            return res;
                        }
                    }
                ],


                menuList: [{
                    ico: 'icon-stop',
                    name: cfWebLang.Util.Stop,
                    act: 'stop'
                }, {
                    ico: 'icon-rotate2',
                    name: cfWebLang.Util.Restart,
                    act: 'reboot'
                }, {
                    ico: 'icon-play3',
                    name: cfWebLang.Util.Start,
                    act: 'boot'
                }, {
                    ico: 'icon-cross',
                    name: cfWebLang.Util.Delete,
                    act: 'delete'
                }, {
                    ico: 'menu3',
                    name: cfWebLang.Util.Detail,
                    act: 'details'
                }
                ],
                store: Ext.create('cfWeb.store.appManage.AppListStore')
            }]
        }];
        this.callParent(arguments);
    }
});
